package com.whxy02.tolearn.app.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whxy02.tolearn.app.beans.Topic;
import com.whxy02.tolearn.app.dao.TopicDao;
import com.whxy02.tolearn.app.service.TopicService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;


@Service
public class TopicServiceImpl implements TopicService {

    private QueryWrapper<Topic> wrapper=new QueryWrapper<>();
    @Resource
    TopicDao topicDao;


    @Override
    public List<Topic> getAll() throws Exception {
        return topicDao.selectList(null);
    }

    @Override
    public Topic getById(Integer id) throws Exception {
        return topicDao.selectById(id);
    }

    @Override
    public int save(Topic topic) throws Exception {
        return topicDao.insert(topic);
    }

    @Override
    public int removeById(Integer id) throws Exception {
        return topicDao.deleteById(id);
    }

    @Override
    public int change(Topic topic) throws Exception {
        return topicDao.updateById(topic);
    }
}
